import Operation.IOperation;
import User.*;
import book.BookList;


import java.util.Scanner;

public class Main {
    public static User Login(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的名字:");
        String name = scanner.nextLine();
        System.out.println("请输入你的身份: 1》管理员  2》用户");
        int choice = scanner.nextInt();
        if(choice == 1){
            System.out.println("你好 " + name + " 欢迎来到图书管理员目录！");
            return new FineUser(name);
        }else {
            System.out.println("你好 " + name  + " 欢迎来到用户目录！");
            return new NomalUser(name);
        }
    }
    public static void main(String[] args) {
            User user = Login();
            BookList bookList = new BookList();
            while(true){
                Scanner scanner = new Scanner(System.in);

                user.menu();
                System.out.println("请选择需要执行的功能: ");
                int choice = scanner.nextInt();
                IOperation iOperation = user.DoOperation(choice);
                iOperation.work(bookList);
            }
    }
}
